_Pragma("once")

#include <tuple>
#include <vector>
#include <memory>
#include <string>
#include <functional>
#include <string_view>
#include <cstring>

#include "WithPoolWorkable.h"
#include "TaskScheduler.h"
#include "StringUtility.h"


extern const std::string WORK_ROOT;
extern const std::string WORK_CONFIG;
extern const std::string VERSION_CONFIG;
extern const std::string SYSTEM_CONFIG;
extern const std::string SYSTEM_STATUS;
extern const std::string OFFLINE_COMMAND_CONFIG;
extern const std::string TIMED_COMMAND_CONFIG;

extern const std::string EXTEND_DEVICE_CONFIG;

extern const std::string NET_ENV_DIR;
extern const std::string NET_ENV_CONFIG;
extern const std::string NETWORK_MANAGE_SCRIPT;

extern const std::string DOWNLOAD_PATHNAME;
extern const std::string UPDATE_TEMP_DIR;
extern const std::string FIRMWARE_UPDATE_SCRIPT;

extern const std::string MODULE_FIRMWARE_DIR;

extern const std::string OFFILE_STATISTIC_DIR;
extern const std::string OFFILE_STATISTIC_FILE;


extern const std::string DEFAULT_UUID;


extern const std::string DELETE_STR;

extern const std::string DEFAULT_SERVER_ADDRESS;

constexpr int CONTENT_LINE_PER_PAGE = 3;

enum class TaskType_t:int8_t {
    DEFAULT_DATA = 1
   ,CALLBACK = 2
};

using Task = std::tuple<TaskType_t, void*>;

class GuiContext;
using WorkerBase = WithPoolWorkable<GuiContext, Task, Task*>;

using ObjectFunction = std::function<void(void)>;


template<class ... ARGS>
Task* buildDynamicFunctor(ARGS&&... argspack){

    Task* pTask = new Task{TaskType_t::CALLBACK, nullptr};
    ObjectFunction* refreshFunction = new ObjectFunction(std::bind(std::forward<ARGS>(argspack)..., pTask));//
    std::get<void*>(*pTask) = refreshFunction;

    return pTask;
}



void releaseDynamicFunctor(const Task*& pTask);


/*
inline std::ostringstream& buildPageHeaderLine(const std::string& data, const int pageNumber, std::ostringstream strStream){

    return strStream;
}*/


extern const StringVectorPtr threePhaseVector;

//constexpr char threePhases[] = "ABC";


extern const StringVectorPtr networkModeVector;


extern TaskScheduler longtimeTaskScheduler;


extern const StringVectorPtr doorStatusVector;

extern const StringVectorPtr zeroOrOne;



extern const std::string LOCK_STATUS[];
